<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
    <meta name="renderer" content="webkit"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <title>用户上架商品</title>
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport"/>
    <meta content="" name="description"/>
    <meta content="" name="author"/>
    <link th:href="@{/css/bootstrap.min.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{/css/bootstrap-responsive.min.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{/css/font-awesome.min.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{/css/style-metro.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{/css/style.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{/css/style-responsive.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{/css/default.css}" rel="stylesheet" type="text/css" id="style_color"/>
    <link th:href="@{/css/uniform.default.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{/css/pagination.css}" rel="stylesheet" type="text/css"/>
    <link rel="stylesheet" type="text/css" th:href="@{/css/bootstrap-fileupload.css}"/>
    <link rel="shortcut icon" th:href="@{/image/favicon.ico}"/>

    <link rel="stylesheet" th:href="@{/layui/css/layui.css}"/>
    <link th:href="@{/css/font-awesome.min.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{/css/common.css}" rel="stylesheet" type="text/css"/>
    <script th:src="@{/layui/jquery-3.2.1.min.js}"></script>
    <script th:src="@{/layui/layui.js}"></script>

</head>
<body class="site-home">
<!--头部模块-->
<div th:replace="mall/common::head"></div>
<div class="layui-container" id="content">
    <!--用户上架商品-->
    <div class="layui-row">
        <div class="layui-col-md12"><h1 class="site-h1"><i class="fa fa-upload" style="color: #FF5722;"></i>
            &nbsp;用户上架商品</h1></div>
    </div>
    <div class="container-fluid">
        <div class="row-fluid">
            <div class="portlet box green">
                <div class="portlet-title">
                    <div class="caption">
                        <i class="fa fa-reorder"></i>
                        发布闲置
                    </div>
                </div>
                <div class="portlet-body">
                    <form class="form-horizontal" enctype="multipart/form-data" method="post" action="/mall/lw/add.do">
                        <div class="control-group">
                            <label class="control-label">商品名称：</label>
                            <div class="controls">
                                <input name="title" type="text" class="m-wrap large"/>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">市场价格：</label>
                            <div class="controls">
                                <div class="input-prepend">
                                    <span class="add-on">￥</span>
                                    <input name="marketPrice" type="text" class="m-wrap small"/>
                                </div>
                                <span class="help-inline">price</span>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">二手价格：</label>
                            <div class="controls">
                                <div class="input-prepend">
                                    <span class="add-on">￥</span>
                                    <input name="shopPrice" type="text" class="m-wrap small"/>
                                </div>
                                <span class="help-inline">price</span>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">所属二级分类：</label>
                            <div class="controls">
                                <select name="csid" class="small m-wrap">
                                </select>
                            </div>
                        </div>

                        <div class="control-group">
                            <label class="control-label">商品图片：</label>
                            <div class="controls">
                                <div class="fileupload fileupload-new" data-provides="fileupload">
                                    <div class="fileupload-new thumbnail" style="width: 200px; height: 150px;">
                                        <img src="" alt=""/>
                                    </div>
                                    <div class="fileupload-preview fileupload-exists thumbnail"
                                         style="max-width: 200px; max-height: 150px; line-height: 20px;"></div>
                                    <div>
											<span class="btn btn-file">
												<span class="fileupload-new">选择图片</span>
												<span class="fileupload-exists">换一张</span>
												<input name="image" type="file" class="default"/>
											</span>
                                        <a href="#" class="btn fileupload-exists" data-dismiss="fileupload">移除</a>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="control-group">
                            <label class="control-label">描述图片：</label>
                            <div class="controls">
                                <div class="fileupload fileupload-new" data-provides="fileupload">
                                    <div class="fileupload-new thumbnail" style="width: 200px; height: 150px;">
                                        <img src="" alt=""/>
                                    </div>
                                    <div class="fileupload-preview fileupload-exists thumbnail"
                                         style="max-width: 200px; max-height: 150px; line-height: 20px;"></div>
                                    <div>
											<span class="btn btn-file">
												<span class="fileupload-new">选择图片 可以上传多张图片</span>
												<span class="fileupload-exists">换一张</span>
												<input name="imageDesc" type="file" class="default" multiple="multiple"/>
											</span>
                                        <a href="#" class="btn fileupload-exists" data-dismiss="fileupload">移除</a>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">商品描述：</label>
                            <div class="controls">
                                <textarea name="desc" class="m-wrap large" rows="4"></textarea>
                            </div>
                        </div>

                        <div class="form-actions">
                            <button type="submit" class="btn blue"><i class="fa fa-check"></i>确定</button>&emsp;
                            <button type="button" onclick="javascript:window.location.href='/mall';" class="btn"><i
                                    class="fa fa-times"></i>返回
                            </button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<!--底部-->
<div th:replace="mall/common::foot"></div>

<script th:src="@{/js/jquery-1.10.1.min.js}" type="text/javascript"></script>
<script th:src="@{/js/jquery-migrate-1.2.1.min.js}" type="text/javascript"></script>
<!-- IMPORTANT! Load jquery-ui-1.10.1.custom.min.js before bootstrap.min.js to fix bootstrap tooltip conflict with jquery ui tooltip -->
<script th:src="@{/js/jquery-ui-1.10.1.custom.min.js}" type="text/javascript"></script>
<script th:src="@{/js/bootstrap.min.js}" type="text/javascript"></script>
<script th:src="@{/js/jquery.slimscroll.min.js}" type="text/javascript"></script>
<script th:src="@{/js/jquery.blockui.min.js}" type="text/javascript"></script>
<script th:src="@{/js/jquery.cookie.min.js}" type="text/javascript"></script>
<script th:src="@{/js/jquery.uniform.min.js}" type="text/javascript"></script>
<script type="text/javascript" th:src="@{/js/bootstrap-fileupload.js}"></script>
<script th:src="@{/js/jquery.pagination.js}" type="text/javascript"></script>
<script th:src="@{/js/app.js}" type="text/javascript"></script>
<script>
    //	<![CDATA[
    $(function () {
        App.init();


        //加载分类列表
        $.ajax({
            url: "../admin/classification/list.do?type=2&pageindex=-1",
            type: "get",
            success: function (result) {
                if (result.state == 0) {
                    showData(result.data);
                } else {
                    alert(result.message);
                }
            }
        });

    });

    function showData(data) {
        var select = $("[name='csid']");
        if (!data || !data.length > 0) {
            return;
        }
        for (var i = 0; i < data.length; i++) {
            var option = $("<option></option>");
            option.attr("value", data[i].id);
            option.text(data[i].cname);
            select.append(option);
        }
    }

    //    ]]>
</script>
</body>
</html>


